package com.lagou.rocket.mq;

import com.lagou.rocket.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RocketMQMessageListener(topic = "topic_order_over", consumerGroup = "consumer_grp_01")
public class MyRocketListener2 implements RocketMQListener<String> {

    @Autowired
    private OrderService orderService;


    @Override
    public void onMessage(String message) {
        // 处理broker推送过来的消息
        log.info(message);
        orderService.recovery(Long.parseLong(message));
    }
}
